import Vue from "vue";
import VueRouter from "vue-router";

// 一级路由
import Home from "../views/Home";
import Login from "../views/Login";

// 二级路由
import News from "../views/Home/News";
import Game from "../views/Home/Game";
import Movie from "../views/Home/Movie";



Vue.use(VueRouter);

export default new VueRouter({
  routes: [
    {
      path: "/home",
      component: Home,
      redirect: "/home/news",
      // 二级路由
      children: [
        {
          path: "news",
          component: News
        },
        {
          path: "game",
          component: Game
        },
        {
          path: "movie",
          component: Movie
        },
      ]
    },
    {
      path: "/login",
      component: Login
    },
    {
      path: "/",
      // 路由重定向
      redirect: "/home"
    }
  ]
});